package com.invest.utils.type;

import com.google.common.collect.Maps;
import org.apache.commons.lang.StringUtils;

import java.util.Map;

/**
 * <p>注释</p>
 *
 * @author yuyizhao
 * @version v0.1 2016/6/14 Exp
 */
public enum SystemUserStatusType {

    NORMAL("正常"),
    FREEZE("冻结");
    private String message;
    private SystemUserStatusType(String message){
        this.message=message;
    }

    private static Map<String,SystemUserStatusType> INSTANCE_MAP = Maps.newHashMap();
    private static  Map<String,String> MSG_MAP = Maps.newLinkedHashMap();
    static{
        for(SystemUserStatusType type : values()){
            INSTANCE_MAP.put(type.name(),type);
            MSG_MAP.put(type.name(),type.message);
        }
    }
    public static Map<String,String> getMsgMap(){
        return MSG_MAP;
    }

    public static SystemUserStatusType instanceOf(String name){
        if(StringUtils.isBlank(name)){
            return null;
        }
        return INSTANCE_MAP.get(name);
    }

    public String getMessage() {
        return message;
    }
}
